<script src="<?= Yii::app()->request->baseUrl; ?>/js/backend/ckeditor/ckeditor.js"></script>
<div class="form">
<div class="table">
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'product-form',
    'htmlOptions' => array(
        'enctype' => 'multipart/form-data',
    ),
	'enableAjaxValidation'=>true,
)); ?>
    <div class="tr">
		<div class="td"><?= $form->labelEx($model,'name'); ?></div>
		<div class="td2"><?= $form->textField($model,'name',array('maxlength'=>50,'class'=>'input','style'=>'width:400px')); ?></div>
		<div class="td3"><?= $form->error($model,'name'); ?></div>
	</div>
    
    <div class="tr">
		<div class="td"><?= CHtml::label(Yii::t('BackEnd','Category'),'category_id'); ?></div>
		<div class="td2">
            <select name="category_id" id="category_id" class="input">
                <?= ProductCategory::listMenu(0, $menuData); ?>
            </select>
        </div>
		<div class="td3"></div>
	</div>
    
    <?php if(!$model->isNewRecord) : ?>
    <div class="tr">
        <div class="td" style="vertical-align: middle;"><?= CHtml::label('Ảnh cũ','old_image',array(' ')); ?></div>
        <div class="td2"><?= CHtml::image(Yii::app()->request->baseUrl.'/data/product/'.$model->image,null,
            array(
                'width'=>'50px',
                'height'=>'50px',
            )); ?></div>
        <div class="td3"></div>
    </div>
    <?php endif; ?>
    
    <div class="tr">
        <?php if($model->isNewRecord) : ?>
		<div class="td"><?= $form->labelEx($model,'image'); ?></div>
        <?php else : ?>
        <div class="td"><?= $form->label($model,'image'); ?></div>
        <?php endif; ?>
		<div class="td2"><?= $form->fileField($model,'image',array('class'=>'input')); ?></div>
		<div class="td3"><?= $form->error($model,'image'); ?></div>
	</div>
    
    <div class="tr">
		<div class="td"><?= $form->labelEx($model,'price'); ?></div>
		<div class="td2"><?= $form->textField($model,'price',array('maxlength'=>10,'class'=>'input','style'=>'width: 120px')); ?> <span style="color: black;">000 <b>VNĐ</b></span></div>
		<div class="td3"><?= $form->error($model,'price'); ?></div>
	</div>
    
    <div class="tr">
		<div class="td"><?= $form->labelEx($model,'sales_price'); ?></div>
		<div class="td2"><?= $form->textField($model,'sales_price',array('maxlength'=>10,'class'=>'input','style'=>'width: 120px')); ?> <span style="color: black;">000 <b>VNĐ</b></span></div>
		<div class="td3"><?= $form->error($model,'sales_price'); ?></div>
	</div>
    
    <div class="tr">
		<div class="td"><?= $form->label($model,'is_hot'); ?></div>
		<div class="td2"><?= $form->dropDownList($model,'is_hot',Product::getIsHotArray(),array('class'=>'input')); ?></div>
		<div class="td3"><?= $form->error($model,'is_hot'); ?></div>
	</div>
    
    <?php if(!$model->isNewRecord) : ?>
	<div class="tr">
		<div class="td"><?= $form->labelEx($model,'status'); ?></div>
		<div class="td2"><?= $form->dropDownList($model,'status',Product::getStatusArray(),array('class'=>'input')); ?></div>
		<div class="td3"><?= $form->error($model,'status'); ?></div>
	</div>
    <?php endif; ?>
    
    <div class="tr">
		<div class="td"><?= $form->label($model,'description'); ?></div>
		<div class="td2"><?= $form->textArea($model,'description',array('class'=>'ckeditor')); ?></div>
		<div class="td3"><?= $form->error($model,'description'); ?></div>
	</div>
    
	<div class="tr"></div>

	<div class="tr">
        <div class="td"></div>
		<div class="td2">
            <?= CHtml::submitButton($model->isNewRecord ? Yii::t('BackEnd','Create') : Yii::t('BackEnd','Update'), array('class' => 'button')); ?>
            <?= CHtml::resetButton(Yii::t('BackEnd','Reset'), array('class' => 'button')); ?>
        </div>
        <div class="td3"></div>
	</div>

<?php $this->endWidget(); ?>
</div>
</div><!-- form -->